import request from '@/utils/request';

/**
 * 分页查询用户
 */
export async function get_list(params) {
  const res = await request.post('/setting/pay_type/get_list', {
    ...params
  });
  if (res.data.code === 1) {
    return {
      list: res.data.data.row_list,
      columns: res.data.data.columns,
      searchData: res.data.data.search_area,
      count: res.data.data.page_info?.total,
      top_button: res.data.data.top_button
    };
  }
  return Promise.reject(res.data.msg);
}
export async function get_pay_type_select(params) {
  const res = await request.post('/setting/pay_type/get_select', {
    ...params
  });
  if (res.data.code === 1) {
    return res.data.data;
  }
  return Promise.reject(res.data.msg);
}
export async function get_pay_type(params) {
  const res = await request.post('/setting/pay_type/get_type', {
    ...params
  });
  if (res.data.code === 1) {
    return res.data.data;
  }
  return Promise.reject(res.data.msg);
}
export async function get_recycling_list(params) {
  const res = await request.post('/setting/pay_type/recycling', {
    ...params
  });
  if (res.data.code === 1) {
    return res.data;
  }
  return Promise.reject(res.data.msg);
}

export async function add(params) {
  const res = await request.post('/setting/pay_type/add', params);
  if (res.data.code === 1) {
    return res.data;
  }
  return Promise.reject(res.data.msg);
}
export async function edit(params) {
  const res = await request.post('/setting/pay_type/edit', params);
  if (res.data.code === 1) {
    return res.data;
  }
  return Promise.reject(res.data.msg);
}
export async function get_detail(params) {
  const res = await request.post('/setting/pay_type/detail', params);
  if (res.data.code === 1) {
    return res.data.data;
  }
  return Promise.reject(res.data.msg);
}
export async function delOpt(params) {
  const res = await request.post('/setting/pay_type/delete', params);
  if (res.data.code === 1) {
    return res.data;
  }
  return Promise.reject(res.data.msg);
}
export async function resume(params) {
  const res = await request.post('/setting/pay_type/resume', params);
  if (res.data.code === 1) {
    return res.data;
  }
  return Promise.reject(res.data.msg);
}
